Micron Document
<!DOCTYPE html>
<html class="client-nojs vector-feature-night-mode-disabled vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-sticky-header-enabled" lang="en" dir="ltr"><head>
<meta charset="UTF-8">
<title>Classification rule</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="canonical" href="https://en.wikipedia.org/wiki/Classification_rule"> <link href="./mw/ext.cite.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/ext.math.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.icons.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.search.codex.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/user.styles.css" rel="stylesheet" type="text/css">
<meta name="ResourceLoaderDynamicStyles" content="">
<link rel="stylesheet" type="text/css" href="./mw/site.styles.css">
<link rel="stylesheet" type="text/css" href="./mw/noscript.css">
<link rel="stylesheet" type="text/css" href="./footer.css">
<link rel="stylesheet" type="text/css" href="./vector-2022.css">
</head>
<body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-Classification_rule rootpage-Classification_rule skin-vector-2022 action-view">
<div class="mw-page-container">
<div class="mw-page-container-inner">
<div class="mw-content-container">
<main id="content" class="mw-body">
<header class="mw-body-header vector-page-titlebar">
<h1 id="firstHeading" class="firstHeading mw-first-heading">
<span id="openzim-page-title" class="mw-page-title-main"><span class="mw-page-title-main">Classification rule</span></span>
</h1>
</header>
<a id="top"></a>
<div id="bodyContent" class="vector-body ve-init-mw-desktopArticleTarget-targetContainer" aria-labelledby="firstHeading" data-mw-ve-target-container="">
<div id="mw-content-text" class="mw-body-content mw-content-ltr" lang="en" dir="ltr"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr"><style data-mw-deduplicate="TemplateStyles:r1305433154">
/* start https://en.wikipedia.org/ */


.mw-parser-output .ambox{border:1px solid #a2a9b1;border-left:10px solid #36c;background-color:#fbfbfb;box-sizing:border-box}.mw-parser-output .ambox+link+.ambox,.mw-parser-output .ambox+link+style+.ambox,.mw-parser-output .ambox+link+link+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+style+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+link+.ambox{margin-top:-1px}html body.mediawiki .mw-parser-output .ambox.mbox-small-left{margin:4px 1em 4px 0;overflow:hidden;width:238px;border-collapse:collapse;font-size:88%;line-height:1.25em}.mw-parser-output .ambox-speedy{border-left:10px solid #b32424;background-color:#fee7e6}.mw-parser-output .ambox-delete{border-left:10px solid #b32424}.mw-parser-output .ambox-content{border-left:10px solid #f28500}.mw-parser-output .ambox-style{border-left:10px solid #fc3}.mw-parser-output .ambox-move{border-left:10px solid #9932cc}.mw-parser-output .ambox-protection{border-left:10px solid #a2a9b1}.mw-parser-output .ambox .mbox-text{border:none;padding:0.25em 0.5em;width:100%}.mw-parser-output .ambox .mbox-image{border:none;padding:2px 0 2px 0.5em;text-align:center}.mw-parser-output .ambox .mbox-imageright{border:none;padding:2px 0.5em 2px 0;text-align:center}.mw-parser-output .ambox .mbox-empty-cell{border:none;padding:0;width:1px}.mw-parser-output .ambox .mbox-image-div{width:52px}@media(min-width:720px){.mw-parser-output .ambox{margin:0 10%}}@media print{body.ns-0 .mw-parser-output .ambox{display:none!important}}


/* end https://en.wikipedia.org/ */
</style><p>Given a population whose members each belong to one of a number of different sets or <a href="Class_(set_theory)" title="Class (set theory)">classes</a>, a <b>classification rule</b> or <b>classifier</b> is a procedure by which the elements of the population set are each predicted to belong to one of the classes.<sup id="cite_ref-1" class="reference"><a href="#cite_note-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup> A perfect <a href="Statistical_classification" title="Statistical classification">classification</a> is one for which every element in the population is assigned to the class it really belongs to. The <a href="Bayes_classifier" title="Bayes classifier">bayes classifier</a> is the classifier which assigns classes optimally based on the known attributes (i.e. features or regressors) of the elements to be classified.
</p><p>A special kind of classification rule is <a href="Binary_classification" title="Binary classification">binary classification</a>, for problems in which there are only two classes.
</p>
<meta property="mw:PageProp/toc">
<div class="mw-heading mw-heading2"><h2 id="Testing_classification_rules">Testing classification rules</h2></div>
<p>Given a data set consisting of pairs <i>x</i> and <i>y</i>, where <i>x</i> denotes an element of the population and <i>y</i> the class it belongs to, a classification rule <i>h</i>(<i>x</i>) is a function that assigns each element <i>x</i> to a predicted class <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle {\hat {y}}=h(x).}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mrow class="MJX-TeXAtom-ORD">
<mrow class="MJX-TeXAtom-ORD">
<mover>
<mi>y</mi>
<mo stretchy="false">^<!-- ^ --></mo>
</mover>
</mrow>
</mrow>
<mo>=</mo>
<mi>h</mi>
<mo stretchy="false">(</mo>
<mi>x</mi>
<mo stretchy="false">)</mo>
<mo>.</mo>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle {\hat {y}}=h(x).}</annotation>
</semantics>
</math></span><img src="./6b575474dd5d13a00b35d043bde9f4d947aec02a.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:9.525ex; height:2.843ex;" alt="{\displaystyle {\hat {y}}=h(x).}" loading="lazy"></span> A binary classification is such that the label <i>y</i> can take only one of two values.
</p><p>The true labels <i>y<sub>i</sub></i> can be known but will not necessarily match their approximations <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle {\hat {y_{i}}}=h(x_{i})}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mrow class="MJX-TeXAtom-ORD">
<mrow class="MJX-TeXAtom-ORD">
<mover>
<msub>
<mi>y</mi>
<mrow class="MJX-TeXAtom-ORD">
<mi>i</mi>
</mrow>
</msub>
<mo stretchy="false">^<!-- ^ --></mo>
</mover>
</mrow>
</mrow>
<mo>=</mo>
<mi>h</mi>
<mo stretchy="false">(</mo>
<msub>
<mi>x</mi>
<mrow class="MJX-TeXAtom-ORD">
<mi>i</mi>
</mrow>
</msub>
<mo stretchy="false">)</mo>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle {\hat {y_{i}}}=h(x_{i})}</annotation>
</semantics>
</math></span><img src="./98476f5f13e9ea2cdada5df87496da8f3c9f7842.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:10.315ex; height:2.843ex;" alt="{\displaystyle {\hat {y_{i}}}=h(x_{i})}" loading="lazy"></span>. In a binary classification, the elements that are not correctly classified are named false positives and false negatives.
</p><p>Some classification rules are static functions. Others can be computer programs. A <a href="Statistical_classification_(machine_learning)" class="mw-redirect" title="Statistical classification (machine learning)">computer classifier</a> can be able to learn or can implement static classification rules. For a training data-set, the true labels <i>y<sub>j</sub></i> are unknown, but it is a prime target for the classification procedure that the approximation <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle {\hat {y_{j}}}=h(x_{j})\approx y_{j}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mrow class="MJX-TeXAtom-ORD">
<mrow class="MJX-TeXAtom-ORD">
<mover>
<msub>
<mi>y</mi>
<mrow class="MJX-TeXAtom-ORD">
<mi>j</mi>
</mrow>
</msub>
<mo stretchy="false">^<!-- ^ --></mo>
</mover>
</mrow>
</mrow>
<mo>=</mo>
<mi>h</mi>
<mo stretchy="false">(</mo>
<msub>
<mi>x</mi>
<mrow class="MJX-TeXAtom-ORD">
<mi>j</mi>
</mrow>
</msub>
<mo stretchy="false">)</mo>
<mo>≈<!-- ≈ --></mo>
<msub>
<mi>y</mi>
<mrow class="MJX-TeXAtom-ORD">
<mi>j</mi>
</mrow>
</msub>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle {\hat {y_{j}}}=h(x_{j})\approx y_{j}}</annotation>
</semantics>
</math></span><img src="./4c46bea338a792b8405ab0b43b621a6e8da29daa.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -1.005ex; width:15.682ex; height:3.009ex;" alt="{\displaystyle {\hat {y_{j}}}=h(x_{j})\approx y_{j}}" loading="lazy"></span> as well as possible, where the quality of this approximation needs to be judged on the basis of the statistical or probabilistic properties of the overall population from which future observations will be drawn.
</p><p>Given a classification rule, a <b>classification test</b> is the result of applying the rule to a finite sample of the initial data set.
</p>
<div class="mw-heading mw-heading2"><h2 id="Binary_and_multiclass_classification">Binary and multiclass classification</h2></div>
<p>Classification can be thought of as two separate problems – <a href="Binary_classification" title="Binary classification">binary classification</a> and <a href="Multiclass_classification" title="Multiclass classification">multiclass classification</a>. In binary classification, a better understood task, only two classes are involved, whereas multiclass classification involves assigning an object to one of several classes.<sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup> Since many classification methods have been developed specifically for binary classification, multiclass classification often requires the combined use of multiple binary classifiers. An important point is that in many practical binary classification problems, the two groups are not symmetric – rather than overall accuracy, the relative proportion of different types of errors is of interest. For example, in medical testing, a false positive (detecting a disease when it is not present) is considered differently from a false negative (not detecting a disease when it is present). In multiclass classifications, the classes may be considered symmetrically (all errors are equivalent), or asymmetrically, which is considerably more complicated.
</p><p>Binary classification methods include <a href="Probit_regression" class="mw-redirect" title="Probit regression">probit regression</a> and <a href="Logistic_regression" title="Logistic regression">logistic regression</a>. Multiclass classification methods include <a href="Multinomial_probit" title="Multinomial probit">multinomial probit</a> and <a href="Multinomial_logit" class="mw-redirect" title="Multinomial logit">multinomial logit</a>.
</p>
<div class="mw-heading mw-heading2"><h2 id="Confusion_Matrix_and_Classifiers">Confusion Matrix and Classifiers</h2></div>

<p>When the classification function is not perfect, false results will appear. In the example in the image to the right. There are 20 dots on the left side of the line (true side) while only 8 of those 20 were actually true. In a similar situation for the right side of the line (false side) where there are 16 dots on the right side and 4 of those 16 dots were inaccurately marked as true. Using the dot locations, we can build a confusion matrix to express the values. We can use 4 different metrics to express the 4 different possible outcomes. There is true positive (TP), false positive (FP), false negative (FN), and true negative (TN).
</p>
<table class="wikitable" style="text-align:right">
<caption>Example confusion matrix
</caption>
<tbody><tr>
<th style="background:var(--background-color-neutral,#eaecf0);color:inherit;background:linear-gradient(to top right,var(--background-color-neutral,#eaecf0) 49%,var(--border-color-base,#a2a9b1) 49.5%,var(--border-color-base,#a2a9b1) 50.5%,var(--background-color-neutral,#eaecf0) 51%);line-height:1.2;padding:0.1em 0.4em;"><div style="margin-left:2em;text-align:right">&nbsp; Predicted</div><div style="margin-right:2em;text-align:left"><br>Actual</div></th>
<th>True</th>
<th>False
</th></tr>
<tr>
<th>True
</th>
<td>8</td>
<td>4
</td></tr>
<tr>
<th>False
</th>
<td>12</td>
<td>12
</td></tr></tbody></table>
<div class="mw-heading mw-heading3"><h3 id="False_positives">False positives</h3></div>
<p><a href="Type_I_and_type_II_errors" title="Type I and type II errors">False positives</a> result when a test falsely (incorrectly) reports a positive result. For example, a <a href="Medical_test" title="Medical test">medical test</a> for a <a href="Disease" title="Disease">disease</a> may return a positive result indicating that the patient has the disease even if the patient does not have the disease. False positive is commonly denoted as the top right (Condition negative X test outcome positive) unit in a <a href="Confusion_matrix" title="Confusion matrix">Confusion matrix</a>.
</p>
<div class="mw-heading mw-heading3"><h3 id="False_negatives">False negatives</h3></div>
<p>On the other hand, <a href="Type_I_and_type_II_errors" title="Type I and type II errors">false negatives</a> result when a test falsely or incorrectly reports a negative result. For example, a medical test for a disease may return a negative result indicating that patient does not have a disease even though the patient actually has the disease. False negative is commonly denoted as the bottom left (Condition positive X test outcome negative) unit in a <a href="Confusion_matrix" title="Confusion matrix">Confusion matrix</a>.
</p>
<div class="mw-heading mw-heading3"><h3 id="True_positives">True positives</h3></div>
<p>True positives result when a test correctly reports a positive result. As an example, a <a href="Medical_test" title="Medical test">medical test</a> for a <a href="Disease" title="Disease">disease</a> may return a positive result indicating that the patient has the disease. This is shown to be true when the patient test confirms the existence of the disease. True positive is commonly denoted as the top left (Condition positive X test outcome positive) unit in a <a href="Confusion_matrix" title="Confusion matrix">Confusion matrix</a>.
</p>
<div class="mw-heading mw-heading3"><h3 id="True_negatives">True negatives</h3></div>
<p>True negative result when a test correctly reports a negative result. As an example, a <a href="Medical_test" title="Medical test">medical test</a> for a <a href="Disease" title="Disease">disease</a> may return a positive result indicating that the patient does not have the disease. This is shown to be true when the patients test also reports not having the disease. True negative is commonly denoted as the bottom right (Condition negative X test outcome negative) unit in a <a href="Confusion_matrix" title="Confusion matrix">Confusion matrix</a>.
</p>
<div class="mw-heading mw-heading2"><h2 id="Application_with_Bayes’_Theorem">Application with Bayes’ Theorem</h2></div>
<p>We can also calculate true positives, false positive, true negative, and false negatives using <a href="Bayes'_theorem" title="Bayes' theorem">Bayes' theorem</a>. Using <a href="Bayes'_theorem" title="Bayes' theorem">Bayes' theorem</a> will help describe the <a href="Probability" title="Probability">Probability</a> of an <a href="Event_(probability_theory)" title="Event (probability theory)">Event (probability theory)</a>, based on prior knowledge of conditions that might be related to the event. Expressed are the four classifications using the example below.
</p>
<ul><li>If a tested patient does not have the disease, the test returns a positive result 5% of the time, or with a probability of 0.05.</li>
<li>Suppose that only 0.1% of the population has that disease, so that a randomly selected patient has a 0.001 prior probability of having the disease.</li>
<li>Let <i>A</i> represent the condition in which the patient has the disease</li>
<li>Let ¬<i>A</i> represent the condition in which the patient does not have the disease</li>
<li>Let <i>B</i> represent the evidence of a positive test result.</li>
<li>Let ¬<i>B</i> represent the evidence of a negative test result.</li></ul>
<p>In terms of true positive, false positive, false negative, and true negative:
</p>
<ul><li>False positive is the probability <i>P</i> that ¬<i>A</i> (The patient does not have the disease) then <i>B</i> (The patient tests positive for the disease) also expressed as <i>P</i>(¬<i>A</i>|B)</li>
<li>False negative is the probability <i>P</i> that <i>A</i> (The patient has the disease) then ¬<i>B</i> (The patient tests negative for the disease) also expressed as <i>P</i>(<i>A</i>|¬<i>B</i>)</li>
<li>True positive is the probability <i>P</i> that <i>A</i> (The patient has the disease) then <i>B</i> (The patient tests positive for the disease) also expressed as <i>P</i>(<i>A</i>|<i>B</i>)</li>
<li>True negative is the probability <i>P</i> that ¬<i>A</i> (The patient does not have the disease) then ¬<i>B</i> (The patient tests negative for the disease) also expressed as <i>P</i>(¬<i>A</i>|¬<i>B</i>)</li></ul>
<div class="mw-heading mw-heading3"><h3 id="False_positives_2">False positives</h3></div>
<p>We can use <a href="Bayes'_theorem" title="Bayes' theorem">Bayes' theorem</a> to determine the probability that a positive result is in fact a false positive. We find that if a disease is rare, then the majority of positive results may be false positives, even if the test is relatively accurate.
</p><p>Naively, one might think that only 5% of positive test results are false, but that is quite wrong, as we shall see.
</p><p>Suppose that only 0.1% of the population has that disease, so that a randomly selected patient has a 0.001 prior probability of having the disease.
</p><p>We can use Bayes' theorem to calculate the probability that a positive test result is a false positive.
</p>
<dl><dd><span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle {\begin{aligned}P(A|B)&amp;={\frac {P(B|A)P(A)}{P(B|A)P(A)+P(B|\neg A)P(\neg A)}}\\\\&amp;={\frac {0.99\times 0.001}{0.99\times 0.001+0.05\times 0.999}}\\~\\&amp;\approx 0.019.\end{aligned}}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mrow class="MJX-TeXAtom-ORD">
<mtable columnalign="right left right left right left right left right left right left" rowspacing="3pt" columnspacing="0em 2em 0em 2em 0em 2em 0em 2em 0em 2em 0em" displaystyle="true">
<mtr>
<mtd>
<mi>P</mi>
<mo stretchy="false">(</mo>
<mi>A</mi>
<mrow class="MJX-TeXAtom-ORD">
<mo stretchy="false">|</mo>
</mrow>
<mi>B</mi>
<mo stretchy="false">)</mo>
</mtd>
<mtd>
<mi></mi>
<mo>=</mo>
<mrow class="MJX-TeXAtom-ORD">
<mfrac>
<mrow>
<mi>P</mi>
<mo stretchy="false">(</mo>
<mi>B</mi>
<mrow class="MJX-TeXAtom-ORD">
<mo stretchy="false">|</mo>
</mrow>
<mi>A</mi>
<mo stretchy="false">)</mo>
<mi>P</mi>
<mo stretchy="false">(</mo>
<mi>A</mi>
<mo stretchy="false">)</mo>
</mrow>
<mrow>
<mi>P</mi>
<mo stretchy="false">(</mo>
<mi>B</mi>
<mrow class="MJX-TeXAtom-ORD">
<mo stretchy="false">|</mo>
</mrow>
<mi>A</mi>
<mo stretchy="false">)</mo>
<mi>P</mi>
<mo stretchy="false">(</mo>
<mi>A</mi>
<mo stretchy="false">)</mo>
<mo>+</mo>
<mi>P</mi>
<mo stretchy="false">(</mo>
<mi>B</mi>
<mrow class="MJX-TeXAtom-ORD">
<mo stretchy="false">|</mo>
</mrow>
<mi mathvariant="normal">¬<!-- ¬ --></mi>
<mi>A</mi>
<mo stretchy="false">)</mo>
<mi>P</mi>
<mo stretchy="false">(</mo>
<mi mathvariant="normal">¬<!-- ¬ --></mi>
<mi>A</mi>
<mo stretchy="false">)</mo>
</mrow>
</mfrac>
</mrow>
</mtd>
</mtr>
<mtr>
<mtd></mtd>
</mtr>
<mtr>
<mtd></mtd>
<mtd>
<mi></mi>
<mo>=</mo>
<mrow class="MJX-TeXAtom-ORD">
<mfrac>
<mrow>
<mn>0.99</mn>
<mo>×<!-- × --></mo>
<mn>0.001</mn>
</mrow>
<mrow>
<mn>0.99</mn>
<mo>×<!-- × --></mo>
<mn>0.001</mn>
<mo>+</mo>
<mn>0.05</mn>
<mo>×<!-- × --></mo>
<mn>0.999</mn>
</mrow>
</mfrac>
</mrow>
</mtd>
</mtr>
<mtr>
<mtd>
<mtext>&nbsp;</mtext>
</mtd>
</mtr>
<mtr>
<mtd></mtd>
<mtd>
<mi></mi>
<mo>≈<!-- ≈ --></mo>
<mn>0.019.</mn>
</mtd>
</mtr>
</mtable>
</mrow>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle {\begin{aligned}P(A|B)&amp;={\frac {P(B|A)P(A)}{P(B|A)P(A)+P(B|\neg A)P(\neg A)}}\\\\&amp;={\frac {0.99\times 0.001}{0.99\times 0.001+0.05\times 0.999}}\\~\\&amp;\approx 0.019.\end{aligned}}}</annotation>
</semantics>
</math></span><img src="./6f827effc65191b6f1f549aec5719faf8db65a32.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -10.005ex; width:44.349ex; height:21.176ex;" alt="{\displaystyle {\begin{aligned}P(A|B)&amp;={\frac {P(B|A)P(A)}{P(B|A)P(A)+P(B|\neg A)P(\neg A)}}\\\\&amp;={\frac {0.99\times 0.001}{0.99\times 0.001+0.05\times 0.999}}\\~\\&amp;\approx 0.019.\end{aligned}}}" loading="lazy"></span></dd></dl>
<p>and hence the probability that a positive result is a false positive is about 1&nbsp;−&nbsp;0.019&nbsp;=&nbsp;0.98, or&nbsp;98%.
</p><p>Despite the apparent high accuracy of the test, the incidence of the disease is so low that the vast majority of patients who test positive do not have the disease. Nonetheless, the fraction of patients who test positive who do have the disease (0.019) is 19 times the fraction of people who have not yet taken the test who have the disease (0.001). Thus the test is not useless, and re-testing may improve the reliability of the result.
</p><p>In order to reduce the problem of false positives, a test should be very accurate in reporting a <i>negative</i> result when the patient does not have the disease. If the test reported a negative result in patients without the disease with probability 0.999, then
</p>
<dl><dd><span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle P(A|B)={\frac {0.99\times 0.001}{0.99\times 0.001+0.001\times 0.999}}\approx 0.5,}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>P</mi>
<mo stretchy="false">(</mo>
<mi>A</mi>
<mrow class="MJX-TeXAtom-ORD">
<mo stretchy="false">|</mo>
</mrow>
<mi>B</mi>
<mo stretchy="false">)</mo>
<mo>=</mo>
<mrow class="MJX-TeXAtom-ORD">
<mfrac>
<mrow>
<mn>0.99</mn>
<mo>×<!-- × --></mo>
<mn>0.001</mn>
</mrow>
<mrow>
<mn>0.99</mn>
<mo>×<!-- × --></mo>
<mn>0.001</mn>
<mo>+</mo>
<mn>0.001</mn>
<mo>×<!-- × --></mo>
<mn>0.999</mn>
</mrow>
</mfrac>
</mrow>
<mo>≈<!-- ≈ --></mo>
<mn>0.5</mn>
<mo>,</mo>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle P(A|B)={\frac {0.99\times 0.001}{0.99\times 0.001+0.001\times 0.999}}\approx 0.5,}</annotation>
</semantics>
</math></span><img src="./7f8399efbb1a1d6d53631c345af724d361842272.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -2.005ex; width:46.906ex; height:5.343ex;" alt="{\displaystyle P(A|B)={\frac {0.99\times 0.001}{0.99\times 0.001+0.001\times 0.999}}\approx 0.5,}" loading="lazy"></span></dd></dl>
<p>so that 1&nbsp;−&nbsp;0.5&nbsp;=&nbsp;0.5 now is the probability of a false positive.
</p>
<div class="mw-heading mw-heading3"><h3 id="False_negatives_2">False negatives</h3></div>
<p>We can use <a href="Bayes'_theorem" title="Bayes' theorem">Bayes' theorem</a> to determine the probability that the negative result is in fact a false negative using the example from above:
</p>
<dl><dd><span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle {\begin{aligned}P(A|\neg B)&amp;={\frac {P(\neg B|A)P(A)}{P(\neg B|A)P(A)+P(\neg B|\neg A)P(\neg A)}}\\\\&amp;={\frac {0.01\times 0.001}{0.01\times 0.001+0.95\times 0.999}}\\~\\&amp;\approx 0.0000105.\end{aligned}}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mrow class="MJX-TeXAtom-ORD">
<mtable columnalign="right left right left right left right left right left right left" rowspacing="3pt" columnspacing="0em 2em 0em 2em 0em 2em 0em 2em 0em 2em 0em" displaystyle="true">
<mtr>
<mtd>
<mi>P</mi>
<mo stretchy="false">(</mo>
<mi>A</mi>
<mrow class="MJX-TeXAtom-ORD">
<mo stretchy="false">|</mo>
</mrow>
<mi mathvariant="normal">¬<!-- ¬ --></mi>
<mi>B</mi>
<mo stretchy="false">)</mo>
</mtd>
<mtd>
<mi></mi>
<mo>=</mo>
<mrow class="MJX-TeXAtom-ORD">
<mfrac>
<mrow>
<mi>P</mi>
<mo stretchy="false">(</mo>
<mi mathvariant="normal">¬<!-- ¬ --></mi>
<mi>B</mi>
<mrow class="MJX-TeXAtom-ORD">
<mo stretchy="false">|</mo>
</mrow>
<mi>A</mi>
<mo stretchy="false">)</mo>
<mi>P</mi>
<mo stretchy="false">(</mo>
<mi>A</mi>
<mo stretchy="false">)</mo>
</mrow>
<mrow>
<mi>P</mi>
<mo stretchy="false">(</mo>
<mi mathvariant="normal">¬<!-- ¬ --></mi>
<mi>B</mi>
<mrow class="MJX-TeXAtom-ORD">
<mo stretchy="false">|</mo>
</mrow>
<mi>A</mi>
<mo stretchy="false">)</mo>
<mi>P</mi>
<mo stretchy="false">(</mo>
<mi>A</mi>
<mo stretchy="false">)</mo>
<mo>+</mo>
<mi>P</mi>
<mo stretchy="false">(</mo>
<mi mathvariant="normal">¬<!-- ¬ --></mi>
<mi>B</mi>
<mrow class="MJX-TeXAtom-ORD">
<mo stretchy="false">|</mo>
</mrow>
<mi mathvariant="normal">¬<!-- ¬ --></mi>
<mi>A</mi>
<mo stretchy="false">)</mo>
<mi>P</mi>
<mo stretchy="false">(</mo>
<mi mathvariant="normal">¬<!-- ¬ --></mi>
<mi>A</mi>
<mo stretchy="false">)</mo>
</mrow>
</mfrac>
</mrow>
</mtd>
</mtr>
<mtr>
<mtd></mtd>
</mtr>
<mtr>
<mtd></mtd>
<mtd>
<mi></mi>
<mo>=</mo>
<mrow class="MJX-TeXAtom-ORD">
<mfrac>
<mrow>
<mn>0.01</mn>
<mo>×<!-- × --></mo>
<mn>0.001</mn>
</mrow>
<mrow>
<mn>0.01</mn>
<mo>×<!-- × --></mo>
<mn>0.001</mn>
<mo>+</mo>
<mn>0.95</mn>
<mo>×<!-- × --></mo>
<mn>0.999</mn>
</mrow>
</mfrac>
</mrow>
</mtd>
</mtr>
<mtr>
<mtd>
<mtext>&nbsp;</mtext>
</mtd>
</mtr>
<mtr>
<mtd></mtd>
<mtd>
<mi></mi>
<mo>≈<!-- ≈ --></mo>
<mn>0.0000105.</mn>
</mtd>
</mtr>
</mtable>
</mrow>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle {\begin{aligned}P(A|\neg B)&amp;={\frac {P(\neg B|A)P(A)}{P(\neg B|A)P(A)+P(\neg B|\neg A)P(\neg A)}}\\\\&amp;={\frac {0.01\times 0.001}{0.01\times 0.001+0.95\times 0.999}}\\~\\&amp;\approx 0.0000105.\end{aligned}}}</annotation>
</semantics>
</math></span><img src="./694f513047a9db19da5f1d075d20fd6078319ca6.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -10.005ex; width:49ex; height:21.176ex;" alt="{\displaystyle {\begin{aligned}P(A|\neg B)&amp;={\frac {P(\neg B|A)P(A)}{P(\neg B|A)P(A)+P(\neg B|\neg A)P(\neg A)}}\\\\&amp;={\frac {0.01\times 0.001}{0.01\times 0.001+0.95\times 0.999}}\\~\\&amp;\approx 0.0000105.\end{aligned}}}" loading="lazy"></span></dd></dl>
<p>The probability that a negative result is a false negative is about 0.0000105 or 0.00105%. When a disease is rare, false negatives will not be a major problem with the test.
</p><p>But if 60% of the population had the disease, then the probability of a false negative would be greater. With the above test, the probability of a false negative would be
</p>
<dl><dd><span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle {\begin{aligned}P(A|\neg B)&amp;={\frac {P(\neg B|A)P(A)}{P(\neg B|A)P(A)+P(\neg B|\neg A)P(\neg A)}}\\\\&amp;={\frac {0.01\times 0.6}{0.01\times 0.6+0.95\times 0.4}}\\~\\&amp;\approx 0.0155.\end{aligned}}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mrow class="MJX-TeXAtom-ORD">
<mtable columnalign="right left right left right left right left right left right left" rowspacing="3pt" columnspacing="0em 2em 0em 2em 0em 2em 0em 2em 0em 2em 0em" displaystyle="true">
<mtr>
<mtd>
<mi>P</mi>
<mo stretchy="false">(</mo>
<mi>A</mi>
<mrow class="MJX-TeXAtom-ORD">
<mo stretchy="false">|</mo>
</mrow>
<mi mathvariant="normal">¬<!-- ¬ --></mi>
<mi>B</mi>
<mo stretchy="false">)</mo>
</mtd>
<mtd>
<mi></mi>
<mo>=</mo>
<mrow class="MJX-TeXAtom-ORD">
<mfrac>
<mrow>
<mi>P</mi>
<mo stretchy="false">(</mo>
<mi mathvariant="normal">¬<!-- ¬ --></mi>
<mi>B</mi>
<mrow class="MJX-TeXAtom-ORD">
<mo stretchy="false">|</mo>
</mrow>
<mi>A</mi>
<mo stretchy="false">)</mo>
<mi>P</mi>
<mo stretchy="false">(</mo>
<mi>A</mi>
<mo stretchy="false">)</mo>
</mrow>
<mrow>
<mi>P</mi>
<mo stretchy="false">(</mo>
<mi mathvariant="normal">¬<!-- ¬ --></mi>
<mi>B</mi>
<mrow class="MJX-TeXAtom-ORD">
<mo stretchy="false">|</mo>
</mrow>
<mi>A</mi>
<mo stretchy="false">)</mo>
<mi>P</mi>
<mo stretchy="false">(</mo>
<mi>A</mi>
<mo stretchy="false">)</mo>
<mo>+</mo>
<mi>P</mi>
<mo stretchy="false">(</mo>
<mi mathvariant="normal">¬<!-- ¬ --></mi>
<mi>B</mi>
<mrow class="MJX-TeXAtom-ORD">
<mo stretchy="false">|</mo>
</mrow>
<mi mathvariant="normal">¬<!-- ¬ --></mi>
<mi>A</mi>
<mo stretchy="false">)</mo>
<mi>P</mi>
<mo stretchy="false">(</mo>
<mi mathvariant="normal">¬<!-- ¬ --></mi>
<mi>A</mi>
<mo stretchy="false">)</mo>
</mrow>
</mfrac>
</mrow>
</mtd>
</mtr>
<mtr>
<mtd></mtd>
</mtr>
<mtr>
<mtd></mtd>
<mtd>
<mi></mi>
<mo>=</mo>
<mrow class="MJX-TeXAtom-ORD">
<mfrac>
<mrow>
<mn>0.01</mn>
<mo>×<!-- × --></mo>
<mn>0.6</mn>
</mrow>
<mrow>
<mn>0.01</mn>
<mo>×<!-- × --></mo>
<mn>0.6</mn>
<mo>+</mo>
<mn>0.95</mn>
<mo>×<!-- × --></mo>
<mn>0.4</mn>
</mrow>
</mfrac>
</mrow>
</mtd>
</mtr>
<mtr>
<mtd>
<mtext>&nbsp;</mtext>
</mtd>
</mtr>
<mtr>
<mtd></mtd>
<mtd>
<mi></mi>
<mo>≈<!-- ≈ --></mo>
<mn>0.0155.</mn>
</mtd>
</mtr>
</mtable>
</mrow>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle {\begin{aligned}P(A|\neg B)&amp;={\frac {P(\neg B|A)P(A)}{P(\neg B|A)P(A)+P(\neg B|\neg A)P(\neg A)}}\\\\&amp;={\frac {0.01\times 0.6}{0.01\times 0.6+0.95\times 0.4}}\\~\\&amp;\approx 0.0155.\end{aligned}}}</annotation>
</semantics>
</math></span><img src="./b17798bf7aac5f27dbe0e79dd3dfffbd244b617d.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -10.005ex; width:49ex; height:21.176ex;" alt="{\displaystyle {\begin{aligned}P(A|\neg B)&amp;={\frac {P(\neg B|A)P(A)}{P(\neg B|A)P(A)+P(\neg B|\neg A)P(\neg A)}}\\\\&amp;={\frac {0.01\times 0.6}{0.01\times 0.6+0.95\times 0.4}}\\~\\&amp;\approx 0.0155.\end{aligned}}}" loading="lazy"></span></dd></dl>
<p>The probability that a negative result is a false negative rises to 0.0155 or&nbsp;1.55%.
</p>
<div class="mw-heading mw-heading3"><h3 id="True_positives_2">True positives</h3></div>
<p>We can use <a href="Bayes'_theorem" title="Bayes' theorem">Bayes' theorem</a> to determine the probability that the positive result is in fact a true positive using the example from above:
</p>
<ul><li>If a tested patient has the disease, the test returns a positive result 99% of the time, or with a probability of 0.99.</li>
<li>If a tested patient does not have the disease, the test returns a positive result 5% of the time, or with a probability of 0.05.</li>
<li>Suppose that only 0.1% of the population has that disease, so that a randomly selected patient has a 0.001 prior probability of having the disease.</li></ul>
<p>Let A represent the condition in which the patient has the disease, and B represent the evidence of a positive test result. Then, the probability that the patient actually has the disease given a positive test result is:
</p>
<dl><dd><span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle {\begin{aligned}P(A|B)&amp;={\frac {P(B|A)P(A)}{P(B|A)P(A)+P(B|\neg A)P(\neg A)}}\\\\&amp;={\frac {0.99\times 0.001}{0.99\times 0.001+0.05\times 0.999}}\\~\\&amp;\approx 0.019.\end{aligned}}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mrow class="MJX-TeXAtom-ORD">
<mtable columnalign="right left right left right left right left right left right left" rowspacing="3pt" columnspacing="0em 2em 0em 2em 0em 2em 0em 2em 0em 2em 0em" displaystyle="true">
<mtr>
<mtd>
<mi>P</mi>
<mo stretchy="false">(</mo>
<mi>A</mi>
<mrow class="MJX-TeXAtom-ORD">
<mo stretchy="false">|</mo>
</mrow>
<mi>B</mi>
<mo stretchy="false">)</mo>
</mtd>
<mtd>
<mi></mi>
<mo>=</mo>
<mrow class="MJX-TeXAtom-ORD">
<mfrac>
<mrow>
<mi>P</mi>
<mo stretchy="false">(</mo>
<mi>B</mi>
<mrow class="MJX-TeXAtom-ORD">
<mo stretchy="false">|</mo>
</mrow>
<mi>A</mi>
<mo stretchy="false">)</mo>
<mi>P</mi>
<mo stretchy="false">(</mo>
<mi>A</mi>
<mo stretchy="false">)</mo>
</mrow>
<mrow>
<mi>P</mi>
<mo stretchy="false">(</mo>
<mi>B</mi>
<mrow class="MJX-TeXAtom-ORD">
<mo stretchy="false">|</mo>
</mrow>
<mi>A</mi>
<mo stretchy="false">)</mo>
<mi>P</mi>
<mo stretchy="false">(</mo>
<mi>A</mi>
<mo stretchy="false">)</mo>
<mo>+</mo>
<mi>P</mi>
<mo stretchy="false">(</mo>
<mi>B</mi>
<mrow class="MJX-TeXAtom-ORD">
<mo stretchy="false">|</mo>
</mrow>
<mi mathvariant="normal">¬<!-- ¬ --></mi>
<mi>A</mi>
<mo stretchy="false">)</mo>
<mi>P</mi>
<mo stretchy="false">(</mo>
<mi mathvariant="normal">¬<!-- ¬ --></mi>
<mi>A</mi>
<mo stretchy="false">)</mo>
</mrow>
</mfrac>
</mrow>
</mtd>
</mtr>
<mtr>
<mtd></mtd>
</mtr>
<mtr>
<mtd></mtd>
<mtd>
<mi></mi>
<mo>=</mo>
<mrow class="MJX-TeXAtom-ORD">
<mfrac>
<mrow>
<mn>0.99</mn>
<mo>×<!-- × --></mo>
<mn>0.001</mn>
</mrow>
<mrow>
<mn>0.99</mn>
<mo>×<!-- × --></mo>
<mn>0.001</mn>
<mo>+</mo>
<mn>0.05</mn>
<mo>×<!-- × --></mo>
<mn>0.999</mn>
</mrow>
</mfrac>
</mrow>
</mtd>
</mtr>
<mtr>
<mtd>
<mtext>&nbsp;</mtext>
</mtd>
</mtr>
<mtr>
<mtd></mtd>
<mtd>
<mi></mi>
<mo>≈<!-- ≈ --></mo>
<mn>0.019.</mn>
</mtd>
</mtr>
</mtable>
</mrow>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle {\begin{aligned}P(A|B)&amp;={\frac {P(B|A)P(A)}{P(B|A)P(A)+P(B|\neg A)P(\neg A)}}\\\\&amp;={\frac {0.99\times 0.001}{0.99\times 0.001+0.05\times 0.999}}\\~\\&amp;\approx 0.019.\end{aligned}}}</annotation>
</semantics>
</math></span><img src="./6f827effc65191b6f1f549aec5719faf8db65a32.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -10.005ex; width:44.349ex; height:21.176ex;" alt="{\displaystyle {\begin{aligned}P(A|B)&amp;={\frac {P(B|A)P(A)}{P(B|A)P(A)+P(B|\neg A)P(\neg A)}}\\\\&amp;={\frac {0.99\times 0.001}{0.99\times 0.001+0.05\times 0.999}}\\~\\&amp;\approx 0.019.\end{aligned}}}" loading="lazy"></span></dd></dl>
<p>The probability that a positive result is a true positive is about 0.019%
</p>
<div class="mw-heading mw-heading3"><h3 id="True_negatives_2">True negatives</h3></div>
<p>We can also use <a href="Bayes'_theorem" title="Bayes' theorem">Bayes' theorem</a> to calculate the probability of true negative. Using the examples above:
</p>
<ul><li>If a tested patient has the disease, the test returns a positive result 99% of the time, or with a probability of 0.99.</li></ul>
<dl><dd><span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle {\begin{aligned}P(\neg A|\neg B)&amp;={\frac {P(\neg B|\neg A)P(A)}{P(\neg B|\neg A)P(\neg A)+P(\neg B|A)P(A)}}\\\\&amp;={\frac {0.99\times 0.999}{0.99\times 0.999+0.05\times 0.001}}\\~\\&amp;\approx 0.0000105.\end{aligned}}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mrow class="MJX-TeXAtom-ORD">
<mtable columnalign="right left right left right left right left right left right left" rowspacing="3pt" columnspacing="0em 2em 0em 2em 0em 2em 0em 2em 0em 2em 0em" displaystyle="true">
<mtr>
<mtd>
<mi>P</mi>
<mo stretchy="false">(</mo>
<mi mathvariant="normal">¬<!-- ¬ --></mi>
<mi>A</mi>
<mrow class="MJX-TeXAtom-ORD">
<mo stretchy="false">|</mo>
</mrow>
<mi mathvariant="normal">¬<!-- ¬ --></mi>
<mi>B</mi>
<mo stretchy="false">)</mo>
</mtd>
<mtd>
<mi></mi>
<mo>=</mo>
<mrow class="MJX-TeXAtom-ORD">
<mfrac>
<mrow>
<mi>P</mi>
<mo stretchy="false">(</mo>
<mi mathvariant="normal">¬<!-- ¬ --></mi>
<mi>B</mi>
<mrow class="MJX-TeXAtom-ORD">
<mo stretchy="false">|</mo>
</mrow>
<mi mathvariant="normal">¬<!-- ¬ --></mi>
<mi>A</mi>
<mo stretchy="false">)</mo>
<mi>P</mi>
<mo stretchy="false">(</mo>
<mi>A</mi>
<mo stretchy="false">)</mo>
</mrow>
<mrow>
<mi>P</mi>
<mo stretchy="false">(</mo>
<mi mathvariant="normal">¬<!-- ¬ --></mi>
<mi>B</mi>
<mrow class="MJX-TeXAtom-ORD">
<mo stretchy="false">|</mo>
</mrow>
<mi mathvariant="normal">¬<!-- ¬ --></mi>
<mi>A</mi>
<mo stretchy="false">)</mo>
<mi>P</mi>
<mo stretchy="false">(</mo>
<mi mathvariant="normal">¬<!-- ¬ --></mi>
<mi>A</mi>
<mo stretchy="false">)</mo>
<mo>+</mo>
<mi>P</mi>
<mo stretchy="false">(</mo>
<mi mathvariant="normal">¬<!-- ¬ --></mi>
<mi>B</mi>
<mrow class="MJX-TeXAtom-ORD">
<mo stretchy="false">|</mo>
</mrow>
<mi>A</mi>
<mo stretchy="false">)</mo>
<mi>P</mi>
<mo stretchy="false">(</mo>
<mi>A</mi>
<mo stretchy="false">)</mo>
</mrow>
</mfrac>
</mrow>
</mtd>
</mtr>
<mtr>
<mtd></mtd>
</mtr>
<mtr>
<mtd></mtd>
<mtd>
<mi></mi>
<mo>=</mo>
<mrow class="MJX-TeXAtom-ORD">
<mfrac>
<mrow>
<mn>0.99</mn>
<mo>×<!-- × --></mo>
<mn>0.999</mn>
</mrow>
<mrow>
<mn>0.99</mn>
<mo>×<!-- × --></mo>
<mn>0.999</mn>
<mo>+</mo>
<mn>0.05</mn>
<mo>×<!-- × --></mo>
<mn>0.001</mn>
</mrow>
</mfrac>
</mrow>
</mtd>
</mtr>
<mtr>
<mtd>
<mtext>&nbsp;</mtext>
</mtd>
</mtr>
<mtr>
<mtd></mtd>
<mtd>
<mi></mi>
<mo>≈<!-- ≈ --></mo>
<mn>0.0000105.</mn>
</mtd>
</mtr>
</mtable>
</mrow>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle {\begin{aligned}P(\neg A|\neg B)&amp;={\frac {P(\neg B|\neg A)P(A)}{P(\neg B|\neg A)P(\neg A)+P(\neg B|A)P(A)}}\\\\&amp;={\frac {0.99\times 0.999}{0.99\times 0.999+0.05\times 0.001}}\\~\\&amp;\approx 0.0000105.\end{aligned}}}</annotation>
</semantics>
</math></span><img src="./6f388715619387065b7ca8bd44d98a4ae84ae636.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -10.005ex; width:50.55ex; height:21.176ex;" alt="{\displaystyle {\begin{aligned}P(\neg A|\neg B)&amp;={\frac {P(\neg B|\neg A)P(A)}{P(\neg B|\neg A)P(\neg A)+P(\neg B|A)P(A)}}\\\\&amp;={\frac {0.99\times 0.999}{0.99\times 0.999+0.05\times 0.001}}\\~\\&amp;\approx 0.0000105.\end{aligned}}}" loading="lazy"></span></dd></dl>
<p>The probability that a negative result is a true negative is 0.9999494 or 99.99%. Since the disease is rare and the positive to positive rate is high and the negative to negative rate is also high, this will produce a large True Negative rate.
</p>
<div class="mw-heading mw-heading2"><h2 id="Measuring_a_classifier_with_sensitivity_and_specificity">Measuring a classifier with sensitivity and specificity</h2></div>
<p>In training a classifier, one may wish to measure its performance using the well-accepted metrics of sensitivity and specificity. It may be instructive to compare the classifier to a random classifier that flips a coin based on the prevalence of a disease. Suppose that the probability a person has the disease is <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle p}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>p</mi>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle p}</annotation>
</semantics>
</math></span><img src="./81eac1e205430d1f40810df36a0edffdc367af36.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.671ex; margin-left: -0.089ex; width:1.259ex; height:2.009ex;" alt="{\displaystyle p}" loading="lazy"></span> and the probability that they do not is <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle q=1-p}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>q</mi>
<mo>=</mo>
<mn>1</mn>
<mo>−<!-- − --></mo>
<mi>p</mi>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle q=1-p}</annotation>
</semantics>
</math></span><img src="./22e387fe24ba3da5f9a0dc424923cdfc2c08990c.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.671ex; width:9.34ex; height:2.509ex;" alt="{\displaystyle q=1-p}" loading="lazy"></span>. Suppose then that we have a random classifier that guesses that the patient has the disease with that same probability <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle p}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>p</mi>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle p}</annotation>
</semantics>
</math></span><img src="./81eac1e205430d1f40810df36a0edffdc367af36.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.671ex; margin-left: -0.089ex; width:1.259ex; height:2.009ex;" alt="{\displaystyle p}" loading="lazy"></span> and guesses that he does not with the same probability <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle q}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>q</mi>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle q}</annotation>
</semantics>
</math></span><img src="./06809d64fa7c817ffc7e323f85997f783dbdf71d.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.671ex; width:1.07ex; height:2.009ex;" alt="{\displaystyle q}" loading="lazy"></span>.
</p><p>The probability of a true positive is the probability that the patient has the disease times the probability that the random classifier guesses this correctly, or <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle p^{2}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<msup>
<mi>p</mi>
<mrow class="MJX-TeXAtom-ORD">
<mn>2</mn>
</mrow>
</msup>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle p^{2}}</annotation>
</semantics>
</math></span><img src="./ef685027b97072ee63a8c738f395cd40f63767e1.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.671ex; margin-left: -0.089ex; width:2.313ex; height:3.009ex;" alt="{\displaystyle p^{2}}" loading="lazy"></span>. With similar reasoning, the probability of a false negative is <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle pq}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>p</mi>
<mi>q</mi>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle pq}</annotation>
</semantics>
</math></span><img src="./ca229b47ba7fdd1f1c92064d4aa3e9d901eb30ae.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.671ex; margin-left: -0.089ex; width:2.328ex; height:2.009ex;" alt="{\displaystyle pq}" loading="lazy"></span>. From the definitions above, the sensitivity of this classifier is <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle p^{2}/(p^{2}+pq)=p}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<msup>
<mi>p</mi>
<mrow class="MJX-TeXAtom-ORD">
<mn>2</mn>
</mrow>
</msup>
<mrow class="MJX-TeXAtom-ORD">
<mo>/</mo>
</mrow>
<mo stretchy="false">(</mo>
<msup>
<mi>p</mi>
<mrow class="MJX-TeXAtom-ORD">
<mn>2</mn>
</mrow>
</msup>
<mo>+</mo>
<mi>p</mi>
<mi>q</mi>
<mo stretchy="false">)</mo>
<mo>=</mo>
<mi>p</mi>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle p^{2}/(p^{2}+pq)=p}</annotation>
</semantics>
</math></span><img src="./fca4276b14df776fedaef0aafc7bf50ba2f29d54.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; margin-left: -0.089ex; width:16.856ex; height:3.176ex;" alt="{\displaystyle p^{2}/(p^{2}+pq)=p}" loading="lazy"></span>. With similar reasoning, we can calculate the specificity as <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle q^{2}/(q^{2}+pq)=q}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<msup>
<mi>q</mi>
<mrow class="MJX-TeXAtom-ORD">
<mn>2</mn>
</mrow>
</msup>
<mrow class="MJX-TeXAtom-ORD">
<mo>/</mo>
</mrow>
<mo stretchy="false">(</mo>
<msup>
<mi>q</mi>
<mrow class="MJX-TeXAtom-ORD">
<mn>2</mn>
</mrow>
</msup>
<mo>+</mo>
<mi>p</mi>
<mi>q</mi>
<mo stretchy="false">)</mo>
<mo>=</mo>
<mi>q</mi>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle q^{2}/(q^{2}+pq)=q}</annotation>
</semantics>
</math></span><img src="./0c5ada7b725e3084023323bcd143f21eba5b09ec.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:16.486ex; height:3.176ex;" alt="{\displaystyle q^{2}/(q^{2}+pq)=q}" loading="lazy"></span>.
</p><p>So, while the measure itself is independent of disease prevalence, the performance of this random classifier depends on disease prevalence. The classifier may have performance that is like this random classifier, but with a better-weighted coin (higher sensitivity and specificity). So, these measures may be influenced by disease prevalence. An alternative measure of performance is the <a href="Matthews_correlation_coefficient" class="mw-redirect" title="Matthews correlation coefficient">Matthews correlation coefficient</a>, for which any random classifier will get an average score of 0.
</p><p>The extension of this concept to non-binary classifications yields the <a href="Confusion_matrix" title="Confusion matrix">confusion matrix</a>.
</p>
<div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2></div>
<ul><li><a href="Bayes_classifier" title="Bayes classifier">Bayes classifier</a></li>
<li><a href="Bayesian_inference" title="Bayesian inference">Bayesian inference</a></li>
<li><a href="Binary_classification" title="Binary classification">Binary classification</a></li>
<li><a href="Decision_rule" title="Decision rule">Decision rule</a></li>
<li><a href="Diagnostic_test" class="mw-redirect" title="Diagnostic test">Diagnostic test</a></li>
<li><a href="Gold_standard_(test)" title="Gold standard (test)">Gold standard (test)</a></li>
<li><a href="Loss_functions_for_classification" title="Loss functions for classification">Loss functions for classification</a></li>
<li><a href="Medical_test" title="Medical test">Medical test</a></li>
<li><a href="Sensitivity_and_specificity" title="Sensitivity and specificity">Sensitivity and specificity</a></li>
<li><a href="Statistical_classification" title="Statistical classification">Statistical classification</a></li></ul>
<div class="mw-heading mw-heading2"><h2 id="Notes">Notes</h2></div>
<style data-mw-deduplicate="TemplateStyles:r1239543626">
/* start https://en.wikipedia.org/ */


.mw-parser-output .reflist{margin-bottom:0.5em;list-style-type:decimal}@media screen{.mw-parser-output .reflist{font-size:90%}}.mw-parser-output .reflist .references{font-size:100%;margin-bottom:0;list-style-type:inherit}.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}.mw-parser-output .reflist-columns{margin-top:0.3em}.mw-parser-output .reflist-columns ol{margin-top:0}.mw-parser-output .reflist-columns li{page-break-inside:avoid;break-inside:avoid-column}.mw-parser-output .reflist-upper-alpha{list-style-type:upper-alpha}.mw-parser-output .reflist-upper-roman{list-style-type:upper-roman}.mw-parser-output .reflist-lower-alpha{list-style-type:lower-alpha}.mw-parser-output .reflist-lower-greek{list-style-type:lower-greek}.mw-parser-output .reflist-lower-roman{list-style-type:lower-roman}


/* end https://en.wikipedia.org/ */
</style><div class="reflist reflist-lower-alpha">
</div>
<div class="mw-heading mw-heading2"><h2 id="References">References</h2></div>
<div class="reflist">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><b><a href="#cite_ref-1">^</a></b></span> <span class="reference-text"><a rel="nofollow" class="external text" href="http://mathworld.wolfram.com/StatisticalTest.html">Mathworld article for statistical test</a></span>
</li>
<li id="cite_note-2"><span class="mw-cite-backlink"><b><a href="#cite_ref-2">^</a></b></span> <span class="reference-text"><a href="Sariel_Har-Peled" title="Sariel Har-Peled">Har-Peled, S.</a>, Roth, D., Zimak, D. (2003) "Constraint Classification for Multiclass Classification and Ranking." In: Becker, B., Thrun, S., Obermayer, K. (Eds) <i>Advances in Neural Information Processing Systems 15: Proceedings of the 2002 Conference</i>, MIT Press. <style data-mw-deduplicate="TemplateStyles:r1238218222">
/* start https://en.wikipedia.org/ */


.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("./mw/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("./mw/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("./mw/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("./mw/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#d33)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#d33)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}


/* end https://en.wikipedia.org/ */
</style><a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a>&nbsp;<bdi>0-262-02550-7</bdi></span>
</li>
</ol></div></div></div><!--htdig_noindex--><div><div class="zim-footer">
This article is issued from <a class="external text" title="Last edited on 2025-02-14" href="https://en.wikipedia.org/wiki/?title=Classification_rule&amp;oldid=1275678652">Wikipedia</a>. The text is available under <a class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en">Creative Commons Attribution-Share Alike 4.0</a> unless otherwise noted. Additional terms may apply for the media files.
</div>
</div><!--/htdig_noindex--></div>
</div>
</main>
</div>
</div>
</div>

</body></html>